package com.huijie.app.sys.aspect;

import com.huijie.app.sys.entity.Log;
import com.huijie.app.sys.service.ILogService;
import com.huijie.core.util.http.ClientIpUtil;

public class SystemAspect {

	/**
	 * 保存日志
	 */
	static class SaveSystemLogThread implements Runnable {
		private Log log;
		private ILogService logService;
		private String logIp;

		public SaveSystemLogThread(Log log, ILogService logService, String logIp) {
			this.log = log;
			this.logService = logService;
			this.logIp = logIp;
		}

		@Override
		public void run() {
			String logIpAddress = ClientIpUtil.getIpAddrSource(logIp);
			log.setLogIpAddress(logIpAddress);
			logService.insertOrUpdate(log);
		}
	}

}
